/**
 * This file is part of 1genia trampoline
 * Copyright (C) 2007 1genia (contact@1genia.com)
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 3 of the License. 
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; see the file COPYING.TXT.  If not,
 * write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301, USA. 
 **/
package com.genia.toolbox.web.gwt.basics.client.exception;

import com.genia.toolbox.web.gwt.basics.client.i18n.GwtI18nMessage;
import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * exception used to send error back to GWT.
 */
public class GwtBundledException
    extends Exception
    implements IsSerializable
{

  /**
   * the serial id for {@link java.io.Serializable}.
   */
  private static final long serialVersionUID = 496782797524817103L;

  /**
   * the GwtI18nMessage to send to the user.
   */
  private GwtI18nMessage gwtI18nMessage;



  /**
   * constructor.
   */
  public GwtBundledException()
  {
    // Do nothing
  }



  /**
   * constructor.
   * 
   * @param cause
   *          the cause (which is saved for later retrieval by the
   *          {@link #getCause()} method). (A <tt>null</tt> value is
   *          permitted, and indicates that the cause is nonexistent or
   *          unknown.)
   */
  public GwtBundledException(final Throwable cause)
  {
    super(cause);
  }



  /**
   * constructor.
   * 
   * @param gwtI18nMessage
   *          the GwtI18nMessage to send to the user
   */
  public GwtBundledException(final GwtI18nMessage gwtI18nMessage)
  {
    this.gwtI18nMessage = gwtI18nMessage;
  }



  /**
   * constructor.
   * 
   * @param cause
   *          the cause (which is saved for later retrieval by the
   *          {@link #getCause()} method). (A <tt>null</tt> value is
   *          permitted, and indicates that the cause is nonexistent or
   *          unknown.)
   * @param gwtI18nMessage
   *          the GwtI18nMessage to send to the user
   */
  public GwtBundledException(final Throwable cause, final GwtI18nMessage gwtI18nMessage)
  {
    this(cause);
    this.gwtI18nMessage = gwtI18nMessage;
  }



  /**
   * getter for the gwtI18nMessage property.
   * 
   * @return the gwtI18nMessage
   */
  public GwtI18nMessage getGwtI18nMessage()
  {
    return gwtI18nMessage;
  }



  /**
   * setter for the gwtI18nMessage property.
   * 
   * @param gwtI18nMessage
   *          the gwtI18nMessage to set
   */
  public void setGwtI18nMessage(final GwtI18nMessage gwtI18nMessage)
  {
    this.gwtI18nMessage = gwtI18nMessage;
  }

}
